﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class EventsSupport : MonoBehaviour , IPointerDownHandler, IPointerUpHandler
{
    /// <summary>
    /// 委托类型变量
    /// </summary>
    Action<PointerEventData> onPointerDownHandler = null;
    Action<PointerEventData> onPointerUpHandler = null;

    public void InitDownUpHandler(Action<PointerEventData> downHandler,Action<PointerEventData> upHandler)
    {
        onPointerDownHandler = downHandler;
        onPointerUpHandler = upHandler;
    }

    public void OnPointerDown(PointerEventData pointerEventData)
    {
        if(onPointerDownHandler != null)
            onPointerDownHandler(pointerEventData);
    }

    public void OnPointerUp(PointerEventData pointerEventData)
    {
        if(onPointerUpHandler != null)
            onPointerUpHandler(pointerEventData);
    }
}
